<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
<meta name="mobileOptimized" content="240" />
<meta name="format-detection" content="telephone=no" />
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript">
function log(s){
	console.log(s);
}
function Player(name){

	//var 定义的变量只提供方法内部调用。相当于私有变量
	var age = name.length;
	
	this.name = name;
	
	this.getAge = function (){
		log(age);
	}
}
Player.prototype={
	getName:function(){
		log(this.name);
		//log(age);
	}
}

var player = new Player("wang");
var player1 = new Player("wang1");

</script>
</body>
</html>